<?php

class Model_Payroll_Shopgroup extends Zend_Db_Table_Abstract {

	protected $_name = 'shop_group';
	
	public function getShopgroup( $idGroup){
		
		$row = $this->fetchRow("`id_group` = ". $idGroup);
		if(!$row) return false;
		return $row->toArray();		
		
		}
		
	public function addShopgroup( $codeGroup , $codeShop){
		
		$data = array(
			
         "code_group" =>  $codeGroup ,
         "code_shop" =>  $codeShop
	
			);
		$this->insert($data);
		
		}
		
	public function updateShopgroup(  $idGroup ,  $codeGroup, $codeShop){
		$data = array(
			"id_group"	=> $idGroup,
         "code_group" =>  $codeGroup ,
         "code_shop" =>  $codeShop 
	
			);
			
		$this->update($data,"`id_group` = ". $idGroup);
		}
		
	public function deleteShopgroup($idGroup){
		
		$this->delete("`id_group` = ". $idGroup);
		
		}	
	
	public function listAll(){
		
		$rows =$this->fetchAll("1","id_group ASC ");
		if(!$rows) return false;
		return $rows->toArray();			
		
		}	
	public function getShopid($codeShop){
		$row = $this->fetchRow("`code_shop` like '%". $codeShop ."%'");
		if(!$row) return false;
		return $row->toArray();
	}	
}



?>